<?php

use Biz\service\theParagraph\Store;
use Biz\tools\GoodsExposureLog;
/**
 * @deprecated
 */
class CollocationInfoAction extends ActionPlugin
{

    const USER_LEVEL = self::LEVEL_NOTHING;

    public function main()
    {
        $collocationId = $this->getRequest()->getQuery('id');
        $roomId = $this->getRequest()->getQuery('room_id');
        if (ctype_digit($roomId) && !ctype_digit($collocationId)) {
            $collocationId = Store::getValidCollocationIdByRoomId($roomId);
        }
        if (ctype_digit($collocationId)) {
            $collocationInfo = Store::GetCollocationInfo($collocationId, $this->uid);
            $collocationList = Store::getStoreIndex($collocationInfo['store_id']);
            $collocationInfo['more'] = array_filter($collocationList, function ($temp) use ($collocationId) {
                return $temp['id'] != $$collocationId;
            });
        } else {
            throw new \Exception('ID不能为空');
        }
        $this->setSuccess($collocationInfo);
        GoodsExposureLog::addLog($this->getRequest(), $collocationInfo,$collocationInfo['id']);
    }
}